//声明 reducer 函数并暴露      
// {type: 'incre', payload: 1 } {type: 'decre', payload: 1 }
const zanReducer = (state=0, action) => {
  switch (action.type) {
    case 'incre':
      return state + action.payload;
    case 'decre':
      return state - action.payload;
    default:
      return state;
  }
}

//暴露
export default zanReducer;

//声明 action creator
export function increAction(payload){
  return {type: 'incre', payload: payload }
}

export function decreAction(payload){
  return {type: 'decre', payload: payload }
}